import request from '@/utils/request'
// import { assign } from 'core-js/core/object'

// getAListOfRoles
// page, pagesize
export const getRoles = (page, pagesize) => {
  return request.get('/sys/role', {
    params: {
      page, pagesize
    }
  })
}

export const delRole = id => request.delete(`/sys/role/${id}`)

// data: { name: '', description: '' }
export const addRole = data => request.post(`/sys/role`, data)

// data: { id, name: '', description: '' }
export const updateRole = data => request.put(`/sys/role/${data.id}`, data)
/*
 * @description: 获取角色详情
 * @param {*} id 角色id
 * @return {*}
 */
export function getRoleDetail(id) {
  return request({
    url: `/sys/role/${id}`
  })
}

export function assignPrem(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
